home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / gdb / tm-sparc.h < prev    next >
C/C++ Source or Header  |  1992-09-11  |  23KB  |  596 lines

  1. /* Parameters for target machine of Sun 4, for GDB, the GNU debugger.
  2.    Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
  3.    Contributed by Michael Tiemann (tiemann@mcc.com)
  4. This file is part of GDB.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #define TARGET_BYTE_ORDER BIG_ENDIAN
  21.  
  22. /* Floating point is IEEE compatible.  */
  23. #define IEEE_FLOAT
  24.  
  25. /* Define this if the C compiler puts an underscore at the front
  26.    of external names before giving them to the linker.  */
  27.  
  28. #define NAMES_HAVE_UNDERSCORE
  29.  
  30. /* Debugger information will be in DBX format.  */
  31.  
  32. #define READ_DBX_FORMAT
  33.  
  34. /* When passing a structure to a function, Sun cc passes the address
  35.    in a register, not the structure itself.  It (under SunOS4) creates
  36.    two symbols, so we get a LOC_ARG saying the address is on the stack
  37.    (a lie, and a serious one since we don't know which register to
  38.    use), and a LOC_REGISTER saying that the struct is in a register
  39.    (sort of a lie, but fixable with REG_STRUCT_HAS_ADDR).  Gcc version
  40.    two (as of 1.92) behaves like sun cc, but I don't know how we can
  41.    distinguish between gcc version 1 and gcc version 2.
  42.  
  43.    This still doesn't work if the argument is not one passed in a
  44.    register (i.e. it's the 7th or later argument).  */
  45. #define REG_STRUCT_HAS_ADDR(gcc_p) (!(gcc_p))
  46. #define STRUCT_ARG_SYM_GARBAGE(gcc_p) (!(gcc_p))
  47.  
  48. /* If Pcc says that a parameter is a short, it's a short.  This is
  49.    because the parameter does get passed in in a register as an int,
  50.    but pcc puts it onto the stack frame as a short (not nailing
  51.    whatever else might be there.  I'm not sure that I consider this
  52.    swift.  Sigh.)
  53.  
  54.    No, don't do this.  The problem here is that pcc says that the
  55.    argument is in the upper half of the word reserved on the stack,
  56.    but puts it in the lower half.  */
  57. /* #define BELIEVE_PCC_PROMOTION 1 */
  58. /* OK, I've added code to dbxread.c to deal with this case.  */
  59. #define BELIEVE_PCC_PROMOTION_TYPE
  60.  
  61. /* Offset from address of function to start of its code.
  62.    Zero on most machines.  */
  63.  
  64. #define FUNCTION_START_OFFSET 0
  65.  
  66. /* Advance PC across any function entry prologue instructions
  67.    to reach some "real" code.  SKIP_PROLOGUE_FRAMELESS_P advances
  68.    the PC past some of the prologue, but stops as soon as it
  69.    knows that the function has a frame.  Its result is equal
  70.    to its input PC if the function is frameless, unequal otherwise.  */
  71.  
  72. #define SKIP_PROLOGUE(pc) \
  73.   { pc = skip_prologue (pc, 0); }
  74. #define SKIP_PROLOGUE_FRAMELESS_P(pc) \
  75.   { pc = skip_prologue (pc, 1); }
  76. extern CORE_ADDR skip_prologue ();
  77.  
  78. /* Immediately after a function call, return the saved pc.
  79.    Can't go through the frames for this because on some machines
  80.    the new frame is not set up until the new function executes
  81.    some instructions.  */
  82.  
  83. /* On the Sun 4 under SunOS, the compile will leave a fake insn which
  84.    encodes the structure size being returned.  If we detect such
  85.    a fake insn, step past it.  */
  86.  
  87. #define PC_ADJUST(pc) sparc_pc_adjust(pc)
  88. extern CORE_ADDR sparc_pc_adjust();
  89.  
  90. #define SAVED_PC_AFTER_CALL(frame) PC_ADJUST (read_register (RP_REGNUM))
  91.  
  92. /* Address of the end of stack space.  We get this from the system
  93.    include files. */
  94. #include <sys/types.h>
  95. #include <machine/vmparam.h>
  96. #define STACK_END_ADDR USRSTACK
  97.  
  98. #define INNER_THAN <
  99.  
  100. /* Stack has strict alignment.  */
  101.  
  102. #define STACK_ALIGN(ADDR) (((ADDR)+7)&-8)
  103.  
  104. /* Sequence of bytes for breakpoint instruction.  */
  105.  
  106. #define BREAKPOINT {0x91, 0xd0, 0x20, 0x01}
  107.  
  108. /* Amount PC must be decremented by after a breakpoint.
  109.    This is often the number of bytes in BREAKPOINT
  110.    but not always.  */
  111.  
  112. #define DECR_PC_AFTER_BREAK 0
  113.  
  114. /* Nonzero if instruction at PC is a return instruction.  */
  115. /* For SPARC, this is either a "jmpl %o7+8,%g0" or "jmpl %i7+8,%g0".
  116.  
  117.    Note: this does not work for functions returning structures under SunOS.  */
  118. #define ABOUT_TO_RETURN(pc) \
  119.   ((read_memory_integer (pc, 4)|0x00040000) == 0x81c7e008)
  120.  
  121. /* Return 1 if P points to an invalid floating point value.  */
  122.  
  123. #define INVALID_FLOAT(p, len) 0   /* Just a first guess; not checked */
  124.  
  125. /* Say how long (ordinary) registers are.  */
  126.  
  127. #define REGISTER_TYPE long
  128.  
  129. /* Number of machine registers */
  130.  
  131. #define NUM_REGS 72
  132.  
  133. /* Initializer for an array of names of registers.
  134.    There should be NUM_REGS strings in this initializer.  */
  135.  
  136. #define REGISTER_NAMES  \
  137. { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",    \
  138.   "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",    \
  139.   "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",    \
  140.   "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",    \
  141.                                 \
  142.   "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",    \
  143.   "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",    \
  144.   "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",    \
  145.   "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",    \
  146.                                                                 \
  147.   "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr" };
  148.  
  149. /* Register numbers of various important registers.
  150.    Note that some of these values are "real" register numbers,
  151.    and correspond to the general registers of the machine,
  152.    and some are "phony" register numbers which are too large
  153.    to be actual register numbers as far as the user is concerned
  154.    but do serve to get the desired values when passed to read_register.  */
  155.  
  156. #define    G0_REGNUM 0             /* %g0 */
  157. #define    G1_REGNUM 1        /* %g1 */
  158. #define O0_REGNUM 8        /* %o0 */
  159. #define    SP_REGNUM 14        /* Contains address of top of stack, \
  160.                    which is also the bottom of the frame.  */
  161. #define    RP_REGNUM 15        /* Contains return address value, *before* \
  162.                    any windows get switched.  */
  163. #define    O7_REGNUM 15        /* Last local reg not saved on stack frame */
  164. #define    L0_REGNUM 16        /* First local reg that's saved on stack frame
  165.                    rather than in machine registers */
  166. #define    I0_REGNUM 24        /* %i0 */
  167. #define    FP_REGNUM 30        /* Contains address of executing stack frame */
  168. #define    I7_REGNUM 31        /* Last local reg saved on stack frame */
  169. #define    FP0_REGNUM 32        /* Floating point register 0 */
  170. #define    Y_REGNUM 64        /* Temp register for multiplication, etc.  */
  171. #define    PS_REGNUM 65        /* Contains processor status */
  172. #define    WIM_REGNUM 66        /* Window Invalid Mask (not really supported) */
  173. #define    TBR_REGNUM 67        /* Trap Base Register (not really supported) */
  174. #define    PC_REGNUM 68        /* Contains program counter */
  175. #define    NPC_REGNUM 69           /* Contains next PC */
  176. #define    FPS_REGNUM 70        /* Floating point status register */
  177. #define    CPS_REGNUM 71        /* Coprocessor status register */
  178.  
  179. /* Total amount of space needed to store our copies of the machine's
  180.    register state, the array `registers'.  */
  181. #define REGISTER_BYTES (32*4+32*4+8*4)
  182.  
  183. /* Index within `registers' of the first byte of the space for
  184.    register N.  */
  185. /* ?? */
  186. #define REGISTER_BYTE(N)  ((N)*4)
  187.  
  188. /* The SPARC processor has register windows.  */
  189.  
  190. #define HAVE_REGISTER_WINDOWS
  191.  
  192. /* Is this register part of the register window system?  A yes answer
  193.    implies that 1) The name of this register will not be the same in
  194.    other frames, and 2) This register is automatically "saved" (out
  195.    registers shifting into ins counts) upon subroutine calls and thus
  196.    there is no need to search more than one stack frame for it. */
  197.  
  198. #define REGISTER_IN_WINDOW_P(regnum)    \
  199.   ((regnum) >= 8 && (regnum) < 32)
  200.  
  201. /* Number of bytes of storage in the actual machine representation
  202.    for register N.  */
  203.  
  204. /* On the SPARC, all regs are 4 bytes.  */
  205.  
  206. #define REGISTER_RAW_SIZE(N) (4)
  207.  
  208. /* Number of bytes of storage in the program's representation
  209.    for register N.  */
  210.  
  211. /* On the SPARC, all regs are 4 bytes.  */
  212.  
  213. #define REGISTER_VIRTUAL_SIZE(N) (4)
  214.  
  215. /* Largest value REGISTER_RAW_SIZE can have.  */
  216.  
  217. #define MAX_REGISTER_RAW_SIZE 8
  218.  
  219. /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
  220.  
  221. #define MAX_REGISTER_VIRTUAL_SIZE 8
  222.  
  223. /* Nonzero if register N requires conversion
  224.    from raw format to virtual format.  */
  225.  
  226. #define REGISTER_CONVERTIBLE(N) (0)
  227.  
  228. /* Convert data from raw format for register REGNUM
  229.    to virtual format for register REGNUM.  */
  230.  
  231. #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
  232. { bcopy ((FROM), (TO), 4); }
  233.  
  234. /* Convert data from virtual format for register REGNUM
  235.    to raw format for register REGNUM.  */
  236.  
  237. #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO)    \
  238. { bcopy ((FROM), (TO), 4); }
  239.  
  240. /* Return the GDB type object for the "standard" data type
  241.    of data in register N.  */
  242.  
  243. #define REGISTER_VIRTUAL_TYPE(N) \
  244.  ((N) < 32 ? builtin_type_int : (N) < 64 ? builtin_type_float : \
  245.   builtin_type_int)
  246.  
  247. /* Writing to %g0 is a noop (not an error or exception or anything like
  248.    that, however).  */
  249.  
  250. #define CANNOT_STORE_REGISTER(regno) ((regno) == G0_REGNUM)
  251.  
  252. /* Store the address of the place in which to copy the structure the
  253.    subroutine will return.  This is called from call_function. */
  254.  
  255. #define STORE_STRUCT_RETURN(ADDR, SP) \
  256.   { target_write_memory ((SP)+(16*4), (char *)&(ADDR), 4); }
  257.  
  258. /* Extract from an array REGBUF containing the (raw) register state
  259.    a function return value of type TYPE, and copy that, in virtual format,
  260.    into VALBUF.  */
  261.  
  262. #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF)          \
  263.   {                                                                                       \
  264.     if (TYPE_CODE (TYPE) == TYPE_CODE_FLT)                          \
  265.       {                                              \
  266.     bcopy (((int *)(REGBUF))+FP0_REGNUM,                          \
  267.            (VALBUF), TYPE_LENGTH(TYPE));                          \
  268.       }                                              \
  269.     else                                          \
  270.       bcopy (((int *)(REGBUF))+8, (VALBUF), TYPE_LENGTH (TYPE));           \
  271.   }
  272.  
  273. /* Write into appropriate registers a function return value
  274.    of type TYPE, given in virtual format.  */
  275. /* On sparc, values are returned in register %o0.  */
  276. #define STORE_RETURN_VALUE(TYPE,VALBUF) \
  277.   {                                                                                                     \
  278.     if (TYPE_CODE (TYPE) == TYPE_CODE_FLT)                     \
  279.       /* Floating-point values are returned in the register pair */          \
  280.       /* formed by %f0 and %f1 (doubles are, anyway).  */                    \
  281.       write_register_bytes (REGISTER_BYTE (FP0_REGNUM), (VALBUF),         \
  282.                 TYPE_LENGTH (TYPE));                 \
  283.     else                                     \
  284.       /* Other values are returned in register %o0.  */                      \
  285.       write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF),         \
  286.                 TYPE_LENGTH (TYPE));  \
  287.   }
  288.  
  289. /* Extract from an array REGBUF containing the (raw) register state
  290.    the address in which a function should return its structure value,
  291.    as a CORE_ADDR (or an expression that can be used as one).  */
  292.  
  293. #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
  294.   (sparc_extract_struct_value_address (REGBUF))
  295. CORE_ADDR sparc_extract_struct_value_address (
  296. #ifdef __STDC__
  297.                           char [REGISTER_BYTES]
  298. #endif
  299.                           );
  300.  
  301.  
  302. /* Describe the pointer in each stack frame to the previous stack frame
  303.    (its caller).  */
  304.  
  305. /* If you're not compiling this on a sun, you'll have to get a copy
  306.    of <sun4/reg.h> (also known as <machine/reg.h>).  */
  307. #include <sun4/reg.h>
  308.  
  309. /* FRAME_CHAIN takes a frame's nominal address
  310.    and produces the frame's chain-pointer.
  311.  
  312.    FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
  313.    and produces the nominal address of the caller frame.
  314.  
  315.    However, if FRAME_CHAIN_VALID returns zero,
  316.    it means the given frame is the outermost one and has no caller.
  317.    In that case, FRAME_CHAIN_COMBINE is not used.  */
  318.  
  319. /* In the case of the Sun 4, the frame-chain's nominal address
  320.    is held in the frame pointer register.
  321.  
  322.    On the Sun4, the frame (in %fp) is %sp for the previous frame.
  323.    From the previous frame's %sp, we can find the previous frame's
  324.    %fp: it is in the save area just above the previous frame's %sp.
  325.  
  326.    If we are setting up an arbitrary frame, we'll need to know where
  327.    it ends.  Hence the following.  This part of the frame cache
  328.    structure should be checked before it is assumed that this frame's
  329.    bottom is in the stack pointer.
  330.  
  331.    If there isn't a frame below this one, the bottom of this frame is
  332.    in the stack pointer.
  333.  
  334.    If there is a frame below this one, and the frame pointers are
  335.    identical, it's a leaf frame and the bottoms are the same also.
  336.  
  337.    Otherwise the bottom of this frame is the top of the next frame.  */
  338.  
  339. #define EXTRA_FRAME_INFO    FRAME_ADDR bottom;
  340. #define INIT_EXTRA_FRAME_INFO(fci)  \
  341.   (fci)->bottom =                    \
  342.    ((fci)->next ?                    \
  343.     ((fci)->frame == (fci)->next_frame ?        \
  344.      (fci)->next->bottom : (fci)->next->frame) :    \
  345.     read_register (SP_REGNUM));
  346.  
  347. #define FRAME_CHAIN(thisframe) (sparc_frame_chain (thisframe))
  348. CORE_ADDR sparc_frame_chain ();
  349.  
  350. #define FRAME_CHAIN_VALID(chain, thisframe) \
  351.   (chain != 0 && (outside_startup_file (FRAME_SAVED_PC (thisframe))))
  352.  
  353. #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
  354.  
  355. /* Define other aspects of the stack frame.  */
  356.  
  357. /* A macro that tells us whether the function invocation represented
  358.    by FI does not have a frame on the stack associated with it.  If it
  359.    does not, FRAMELESS is set to 1, else 0.  */
  360. #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
  361.   (FRAMELESS) = frameless_look_for_prologue(FI)
  362.  
  363. /* Where is the PC for a specific frame */
  364.  
  365. #define FRAME_SAVED_PC(FRAME) frame_saved_pc (FRAME)
  366. CORE_ADDR frame_saved_pc ();
  367.  
  368. /* If the argument is on the stack, it will be here.  */
  369. #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
  370.  
  371. #define FRAME_STRUCT_ARGS_ADDRESS(fi) ((fi)->frame)
  372.  
  373. #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
  374.  
  375. /* Set VAL to the number of args passed to frame described by FI.
  376.    Can set VAL to -1, meaning no way to tell.  */
  377.  
  378. /* We can't tell how many args there are
  379.    now that the C compiler delays popping them.  */
  380. #define FRAME_NUM_ARGS(val,fi) (val = -1)
  381.  
  382. /* Return number of bytes at start of arglist that are not really args.  */
  383.  
  384. #define FRAME_ARGS_SKIP 68
  385.  
  386. /* Put here the code to store, into a struct frame_saved_regs,
  387.    the addresses of the saved registers of frame described by FRAME_INFO.
  388.    The actual code is in sparc-tdep.c so we can debug it sanely.  */
  389.  
  390. #define FRAME_FIND_SAVED_REGS(fi, frame_saved_regs)            \
  391.     sparc_frame_find_saved_regs ((fi), &(frame_saved_regs))
  392. extern void sparc_frame_find_saved_regs ();
  393.  
  394. /* Things needed for making the inferior call functions.  */
  395. /*
  396.  * First of all, let me give my opinion of what the DUMMY_FRAME
  397.  * actually looks like.
  398.  *
  399.  *               |                                 |
  400.  *               |                                 |
  401.  *               + - - - - - - - - - - - - - - - - +<-- fp (level 0)
  402.  *               |                                 |
  403.  *               |                                 |
  404.  *               |                                 |
  405.  *               |                                 |
  406.  *               |  Frame of innermost program     |
  407.  *               |           function              |
  408.  *               |                                 |
  409.  *               |                                 |
  410.  *               |                                 |
  411.  *               |                                 |
  412.  *               |                                 |
  413.  *               |---------------------------------|<-- sp (level 0), fp (c)
  414.  *               |                                 |
  415.  *     DUMMY     |             fp0-31              |
  416.  *               |                                 |
  417.  *               |             ------              |<-- fp - 0x80
  418.  *     FRAME     |              g0-7               |<-- fp - 0xa0
  419.  *               |              i0-7               |<-- fp - 0xc0
  420.  *               |             other               |<-- fp - 0xe0
  421.  *               |               ?                 |
  422.  *               |               ?                 |
  423.  *               |---------------------------------|<-- sp' = fp - 0x140
  424.  *               |                                 |
  425.  * xcution start |                                 |
  426.  * sp' + 0x94 -->|        CALL_DUMMY (x code)      |
  427.  *               |                                 |
  428.  *               |                                 |
  429.  *               |---------------------------------|<-- sp'' = fp - 0x200
  430.  *               |  align sp to 8 byte boundary    |
  431.  *               |     ==> args to fn <==          |
  432.  *  Room for     |                                 |
  433.  * i & l's + agg | CALL_DUMMY_STACK_ADJUST = 0x0x44|
  434.  *               |---------------------------------|<-- final sp (variable)
  435.  *               |                                 |
  436.  *               |   Where function called will    |
  437.  *               |           build frame.          |
  438.  *               |                                 |
  439.  *               |                                 |
  440.  *
  441.  *   I understand everything in this picture except what the space
  442.  * between fp - 0xe0 and fp - 0x140 is used for.  Oh, and I don't
  443.  * understand why there's a large chunk of CALL_DUMMY that never gets
  444.  * executed (its function is superceeded by PUSH_DUMMY_FRAME; they
  445.  * are designed to do the same thing).
  446.  *
  447.  *   PUSH_DUMMY_FRAME saves the registers above sp' and pushes the
  448.  * register file stack down one.
  449.  *
  450.  *   call_function then writes CALL_DUMMY, pushes the args onto the
  451.  * stack, and adjusts the stack pointer.
  452.  *
  453.  *   run_stack_dummy then starts execution (in the middle of
  454.  * CALL_DUMMY, as directed by call_function).
  455.  */
  456.  
  457. /* Push an empty stack frame, to record the current PC, etc.  */
  458.  
  459. #define PUSH_DUMMY_FRAME    sparc_push_dummy_frame ()
  460. #define POP_FRAME    sparc_pop_frame ()
  461.  
  462. void sparc_push_dummy_frame (), sparc_pop_frame ();
  463. /* This sequence of words is the instructions
  464.  
  465.    save %sp,-0x140,%sp
  466.    std    %f30,[%fp-0x08]
  467.    std    %f28,[%fp-0x10]
  468.    std    %f26,[%fp-0x18]
  469.    std    %f24,[%fp-0x20]
  470.    std    %f22,[%fp-0x28]
  471.    std    %f20,[%fp-0x30]
  472.    std    %f18,[%fp-0x38]
  473.    std    %f16,[%fp-0x40]
  474.    std    %f14,[%fp-0x48]
  475.    std    %f12,[%fp-0x50]
  476.    std    %f10,[%fp-0x58]
  477.    std    %f8,[%fp-0x60]
  478.    std    %f6,[%fp-0x68]
  479.    std    %f4,[%fp-0x70]
  480.    std    %f2,[%fp-0x78]
  481.    std    %f0,[%fp-0x80]
  482.    std    %g6,[%fp-0x88]
  483.    std    %g4,[%fp-0x90]
  484.    std    %g2,[%fp-0x98]
  485.    std    %g0,[%fp-0xa0]
  486.    std    %i6,[%fp-0xa8]
  487.    std    %i4,[%fp-0xb0]
  488.    std    %i2,[%fp-0xb8]
  489.    std    %i0,[%fp-0xc0]
  490.    nop ! stcsr    [%fp-0xc4]
  491.    nop ! stfsr    [%fp-0xc8]
  492.    nop ! wr    %npc,[%fp-0xcc]
  493.    nop ! wr    %pc,[%fp-0xd0]
  494.    rd    %tbr,%o0
  495.    st    %o0,[%fp-0xd4]
  496.    rd    %wim,%o1
  497.    st    %o0,[%fp-0xd8]
  498.    rd    %psr,%o0
  499.    st    %o0,[%fp-0xdc]
  500.    rd    %y,%o0
  501.    st    %o0,[%fp-0xe0]
  502.  
  503.      /..* The arguments are pushed at this point by GDB;
  504.     no code is needed in the dummy for this.
  505.     The CALL_DUMMY_START_OFFSET gives the position of
  506.     the following ld instruction.  *../
  507.  
  508.    ld    [%sp+0x58],%o5
  509.    ld    [%sp+0x54],%o4
  510.    ld    [%sp+0x50],%o3
  511.    ld    [%sp+0x4c],%o2
  512.    ld    [%sp+0x48],%o1
  513.    call 0x00000000
  514.    ld    [%sp+0x44],%o0
  515.    nop
  516.    ta 1
  517.    nop
  518.  
  519.    note that this is 192 bytes, which is a multiple of 8 (not only 4) bytes.
  520.    note that the `call' insn is a relative, not an absolute call.
  521.    note that the `nop' at the end is needed to keep the trap from
  522.         clobbering things (if NPC pointed to garbage instead).
  523.  
  524. We actually start executing at the `sethi', since the pushing of the
  525. registers (as arguments) is done by PUSH_DUMMY_FRAME.  If this were
  526. real code, the arguments for the function called by the CALL would be
  527. pushed between the list of ST insns and the CALL, and we could allow
  528. it to execute through.  But the arguments have to be pushed by GDB
  529. after the PUSH_DUMMY_FRAME is done, and we cannot allow these ST
  530. insns to be performed again, lest the registers saved be taken for
  531. arguments.  */
  532.  
  533. #define CALL_DUMMY { 0x9de3bee0, 0xfd3fbff8, 0xf93fbff0, 0xf53fbfe8,    \
  534.              0xf13fbfe0, 0xed3fbfd8, 0xe93fbfd0, 0xe53fbfc8,    \
  535.              0xe13fbfc0, 0xdd3fbfb8, 0xd93fbfb0, 0xd53fbfa8,    \
  536.              0xd13fbfa0, 0xcd3fbf98, 0xc93fbf90, 0xc53fbf88,    \
  537.              0xc13fbf80, 0xcc3fbf78, 0xc83fbf70, 0xc43fbf68,    \
  538.              0xc03fbf60, 0xfc3fbf58, 0xf83fbf50, 0xf43fbf48,    \
  539.              0xf03fbf40, 0x01000000, 0x01000000, 0x01000000,    \
  540.              0x01000000, 0x91580000, 0xd027bf50, 0x93500000,    \
  541.              0xd027bf4c, 0x91480000, 0xd027bf48, 0x91400000,    \
  542.              0xd027bf44, 0xda03a058, 0xd803a054, 0xd603a050,    \
  543.              0xd403a04c, 0xd203a048, 0x40000000, 0xd003a044,    \
  544.              0x01000000, 0x91d02001, 0x01000000, 0x01000000}
  545.  
  546. #define CALL_DUMMY_LENGTH 192
  547.  
  548. #define CALL_DUMMY_START_OFFSET 148
  549.  
  550. #define CALL_DUMMY_STACK_ADJUST 68
  551.  
  552. /* Insert the specified number of args and function address
  553.    into a call sequence of the above form stored at DUMMYNAME.
  554.  
  555.    For structs and unions, if the function was compiled with Sun cc,
  556.    it expects 'unimp' after the call.  But gcc doesn't use that
  557.    (twisted) convention.  So leave a nop there for gcc (FIX_CALL_DUMMY
  558.    can assume it is operating on a pristine CALL_DUMMY, not one that
  559.    has already been customized for a different function).  */
  560.  
  561. #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p)     \
  562. {                                    \
  563.   *(int *)((char *) dummyname+168) = (0x40000000|((fun-(pc+168))>>2));    \
  564.   if (!gcc_p                                                            \
  565.       && (TYPE_CODE (type) == TYPE_CODE_STRUCT                \
  566.       || TYPE_CODE (type) == TYPE_CODE_UNION))                    \
  567.     *(int *)((char *) dummyname+176) = (TYPE_LENGTH (type) & 0x1fff);    \
  568. }
  569.  
  570.  
  571. /* Sparc has no reliable single step ptrace call */
  572.  
  573. #define NO_SINGLE_STEP 1
  574. extern void single_step ();
  575.  
  576. /* We need two arguments (in general) to the "info frame" command.
  577.    Note that the definition of this macro implies that there exists a
  578.    function "setup_arbitrary_frame" in sparc-tdep.c */
  579.  
  580. #define FRAME_SPECIFICATION_DYADIC
  581.  
  582. /* To print every pair of float registers as a double, we use this hook.  */
  583.  
  584. #define    PRINT_REGISTER_HOOK(regno)    \
  585.   if (((regno) >= FP0_REGNUM)        \
  586.    && ((regno) <  FP0_REGNUM + 32)    \
  587.    && (0 == (regno & 1))) {        \
  588.     char doublereg[8];        /* two float regs */    \
  589.     if (!read_relative_register_raw_bytes (i  , doublereg  )    \
  590.      && !read_relative_register_raw_bytes (i+1, doublereg+4)) {    \
  591.       printf("\t");            \
  592.       print_floating (doublereg, builtin_type_double, stdout);    \
  593.     }                    \
  594.   }
  595.  
  596.